Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance file search to include subdirectories using glob [Update fid_score.py] #113

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

XavierJiezou
Copy link

This PR enhances the file search functionality to include subdirectories by using glob.glob with the recursive=True parameter. This change ensures that all image files within the specified directory and its subdirectories are found, improving the flexibility and robustness of the file search.

Fixed issue

  • Replaced pathlib.Path.glob with glob.glob to enable recursive search.
  • Ensured compatibility with existing code by maintaining the use of standard libraries.

Details

# Before
files = sorted(
    [file for ext in IMAGE_EXTENSIONS for file in path.glob("*.{}".format(ext))]
)

# After
import glob

files = sorted([file for ext in IMAGE_EXTENSIONS for file in glob.glob(os.path.join(path, '**/*.{}'.format(ext)), recursive=True)])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant